home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / program / 356 / context2 / context.doc < prev    next >
Text File  |  1990-02-02  |  24KB  |  577 lines

  1.  
  2. ===========================================================================
  3.  
  4.           ***************       ConTEXT v2        ****************
  5.                        
  6.                            A Programming Editor
  7.  
  8.                    (C) Don Milne and MicroPack Ltd 1986 
  9.  
  10. ===========================================================================
  11.  
  12. Here at last (yet again) the long promised version two of my programming
  13. editor. I finally decided to call it ConTEXT (as opposed to Context,
  14. ConText or CONTEXT). I originally used that name partly because that seems
  15. a nice name for an editor, and partly because it was the name I had thought
  16. up for a context-sensitive editor that I never got around to writing (I
  17. went off the context-sensitive idea before I had written a line). 
  18.  
  19. When I released version one of this program I said in the docs that I was
  20. reasonably sure that there was no serious bugs in it. Boy was I wrong! The
  21. basis of my original confidence was that I was using the program myself
  22. every day and had found no bugs, but I had not appreciated just how much
  23. some peoples working practices differed from mine - and some of those
  24. different but quite valid practices turned up bugs that I had not.
  25.  
  26. My grateful thanks goes to Ron Sprunger who put in a great deal of his time
  27. and provided me with two detailed lists of bugs, misfeatures and
  28. improvement suggestions. These were invaluable to me in preparing ConTEXT
  29. v2. My thanks also to Jim Fox for uploading the code to BIX at a time when
  30. I did not myself have the necessary software (well, I had CrossTalk (on a
  31. PC) which supports Xmodem, but Xmodem is just too slow and expensive for
  32. uploading from the UK). 
  33.  
  34. I had hoped to provide multiple editing windows in this version of ConTEXT,
  35. but that will take a certain amount of work to achieve, and I simply cannot
  36. afford the time at the moment (not unless ConTEXT becomes a paying concern
  37. at any rate). So, rather than withhold the program until every last feature
  38. is added I have decided to get it out *now* and start getting feedback
  39. *now*. Do let me know what you think of my work either on BIX (my BIX-ID is
  40. "mpack"), or by phone or mail (see below for the address). 
  41.  
  42. ConTEXT is distributed on a shareware basis - it is not public domain. I
  43. like the shareware concept because I am a programmer who does not believe
  44. in copy protection, or in charging rip-off prices for a piece of code.
  45. However I *do* believe that a programmer should be payed a fair price for
  46. his work, and I have put a great deal of work into this. If you use this
  47. program and feel that it is worth something then I would be grateful if you
  48. could send me whatever you think it is worth (I think that around $40 is
  49. about right - or 40 pounds if you live in the UK). Remember that the amount
  50. of time I devote to this program in future will depend greatly on how much
  51. you make it worth my while - I have to eat you know!
  52.  
  53. As an incentive, users who register register will receive a copy of the
  54. latest version of the editor, and will be informed when later versions are
  55. available, and will be able to get those updates for the price of a disk
  56. and the return postage. The Modula-2 program source will also be available
  57. to registered users for a further payment of $50 (or 50 pounds in the UK),
  58. you can order it when you register if you like.
  59.  
  60. Our address is in the 'About ConTEXT' box in the editor. Payment is by
  61. bankers draft, or by cheque drawn on a UK bank made payable to 'MicroPack
  62. Ltd'. We can also accept payment by VISA or American Express, if you want
  63. to do so then please drop me a line (on BIX, or by phone or mail), giving
  64. me the card number, the expiry date, and the name of the card holder.
  65.  
  66. ---------------------------------------------------------------------------
  67.  
  68. ConTEXT's sole reason for existance is that TDI's editor was so bad,
  69. I was prepared to write my own rather than use theirs. 1st Word is a
  70. good editor in many ways (and still is for real word processing), but
  71. as a programming editor just couldn't hack it (I'm spoiled - I can't work
  72. without autoindent by default, plus integration with the compiler). Note
  73. that if you want to use this editor from the TDI Desktop, you should
  74. rename CONTEXT.PRG as EDITOR.PRG (that's what the Desktop looks for when
  75. you invoke the editor).
  76.  
  77. ConTEXT can be operated using the standard GEM mouse and menu interface, or
  78. entirely from the keyboard. The keyboard commands are totally configurable,
  79. and comes ready configured with commands which are almost all WordStar (tm)
  80. compatable - users of the Turbo Pascal (tm) editor will also find these
  81. commands familiar. ConTEXT also makes use of some of the special purpose
  82. keys on the Atari ST keyboard. 
  83.  
  84. As a consequence of various tricks being used to speed up Screen IO,
  85. ConTEXT does not interact all that well with some Desk Accessories, one
  86. unfortunate example being the M2 Options Accessory. This is one bug that
  87. has remained from the original version of the editor, mainly because it is
  88. not much of a problem - in fact the only accessory I have found which gives
  89. problems is TDI's one, so now I just don't use it within ConTEXT.
  90.  
  91. ConTEXT requires an Atari 520 or 1040 ST, Monochrome or Medium Res Color.
  92.  
  93. Don Milne.
  94. MicroPack Ltd.
  95.  
  96. ------------------------------------------------------------------------
  97.  
  98. The Files on the Disk
  99. =====================
  100.  
  101. These are the files which you recieve with ConTEXT:-
  102.  
  103.  
  104. CONTEXT.PRG            - ConTEXT, the program itself.
  105.  
  106. CONTEXT2.RSC           - the resource file for ConTEXT, usable in mono or
  107.                          medium res. This must be in the current directory
  108.                          when ConTEXT is run.
  109.  
  110. CCONTEXT.PRG           - Configure ConTEXT. Use this program to change the
  111.                          keyboard commands to some you like better. Also
  112.                          used to load the compiler error messages, and the
  113.                          "built-in" macros.
  114.  
  115. CONTEXT.CFG            - ConTEXT's configuration file, produced by
  116.                          CCONTEXT. This must be in the current directory
  117.                          when ConTEXT is run.
  118.  
  119.  
  120. ERRORS.TXT             - A list of errors reported by the compiler. This
  121.                          file is required by CCONTEXT.
  122.  
  123. MACROS.TXT             - A list of macros to be bound in to the editor as
  124.                          if they were normal, built-in commands. This file
  125.                          is used by CCONTEXT but is not required.
  126.  
  127. CONTEXT.DOC            - This file.
  128.  
  129.  
  130. ------------------------------------------------------------------------
  131.  
  132.  
  133. WordStar Command Summary
  134. ========================
  135.  
  136. The following sections describe the default, WordStar/Turbo-compatible
  137. command set that I provide as the standard configuration with ConTEXT. If
  138. you have reconfigured with your own prefered commands then this will not be
  139. of much use to you, but then you ought to know what you did yourself! 
  140.  
  141.  
  142. CURSOR CONTROL
  143. --------------
  144.  
  145. WordStar Cursor movement keys are intended to be mnemonic because of
  146. the physical organisation of the keys on a standard keyboard, and not
  147. because of the letters on the keys themselves.
  148.  
  149. Unlike the Turbo Pascal editor, all cursor movement commands wrap onto
  150. next or previous lines. For example typing cursor-right when the cursor
  151. is already at the right of a line causes the cursor to be moved to the
  152. beginning of the next line. If your intention was actually to insert a
  153. space at the end of the line you should use the space bar instead.
  154.  
  155. Also unlike the Turbo editor is the feature that lines deleted using
  156. the "Delete Line" command (^Y or FKey10), are copied into the paste
  157. buffer before deletion. The line can be restored by typing the UNDO
  158. key. In fact several lines may be deleted at a time, (using consecutive
  159. "Delete Line" commands), and all will be restored by typing the UNDO key AS
  160. LONG AS YOU DO NOTHING WHICH AFFECTS THE PASTE BUFFER BEFOREHAND. The paste
  161. buffer is affected by block operations, and by delete operations. Besides
  162. adding a touch of protection against disasters, this feature is often used
  163. in preference to a WordStar block command. Where just a few lines are
  164. involved this method is usually more convenient.
  165.  
  166. Text removed using the Block Delete command is also copied into the paste
  167. buffer and may be restored by typing UNDO.
  168.  
  169. The only major deviation from Turbo is that ConTEXT uses the "^Q-E"
  170. sequence to mean "Find Error" (find a compiler-reported error). In
  171. WordStar/Turbo, ^Q-E means "move to top-of-page". The opposite command
  172. (^Q-X, "move to bottom-of-page"), is also removed to preserve symmetry.
  173. Also note that ConTEXT interpretes the "Global" flag in replace
  174. operations somewhat differently - In the Turbo editor setting "Global"
  175. means "Replace all occurrences of the target", while ConTEXT interpretes it
  176. as "Replace all occurrences of the target STARTING FROM THE CURRENT CURSOR
  177. POSITION". To achieve the same results as the Turbo example you need to
  178. jump to the top of the file before executing the replace.
  179.  
  180.  
  181. Movement Commands
  182. -----------------
  183.  
  184. Command Description           Keystroke(s)          ST Alternate
  185.  
  186. Line Up                          ^E                 Cursor Up
  187. Line Down                        ^X                 Cursor Down
  188. Character Left                   ^S                 Cursor Left  ( <-- )
  189. Character Right                  ^D                 Cursor Right ( --> )
  190. Word Left                        ^A
  191. Word Right                       ^F
  192. Scroll Up                        ^W
  193. Scroll Down                      ^Z
  194. Page Up                          ^R                 '-' key on keypad
  195. Page Down                        ^C                 '+' key on keypad
  196. Left on Text                                        '0' key on keypad
  197. Left on Line                     ^Q-S
  198. Right on Line                    ^Q-D               '.' key on keypad
  199. Top of File                      ^Q-R               '*' key on keypad
  200. End of File                      ^Q-C               'Enter' key on keypad
  201. Start of Block                   ^Q-B
  202. End of Block                     ^Q-K
  203. Jump to Marked Position          ^K-J
  204.  
  205.  
  206. Insert and Delete Commands
  207. --------------------------
  208.  
  209. Command Description           Keystroke(s)          ST Alternate
  210.  
  211. Insert Mode On/Off               ^V                 Insert
  212. Insert Line                      ^N
  213. Delete Line                      ^Y                 FKey10
  214. Undelete Lines                                      Undo
  215. Delete to End of Line            ^Q-Y
  216. Delete Character under Cursor    ^G                 Delete
  217. Delete Character to Left         ^H                 BackSpace
  218. Delete Word                      ^T^T or ^T-T
  219. Insert Tab (size 1)              ^I                 Tab
  220. Insert Tab (size 2)                                 ALT-TAB
  221.  
  222.  
  223.  
  224. Block Commands
  225. --------------
  226.  
  227. Command Description           Keystroke(s)          ST Alternate
  228.  
  229. Mark Block Begin                 ^K-B               FKey7
  230. Mark Block End                   ^K-K               FKey8
  231. Mark Single Word                 ^K-T
  232. Hide/Display Block               ^K-H
  233. Copy Block                       ^K-C
  234. Move Block                       ^K-V
  235. Delete Block                     ^K-Y
  236. Read Block from Disk             ^K-R
  237. Write Block to Disk              ^K-W
  238. Print Block                      ^K-P
  239.  
  240.  
  241.  
  242. Macro Commands
  243. --------------
  244.  
  245. Command Description           Keystroke(s)          ST Alternate
  246.  
  247. Execute Macro                                       FKey2
  248. Read Macro                                          FKey3
  249. Record Macro                                        FKey4
  250. Write Macro                                         FKey5
  251.  
  252.  
  253.  
  254. File Commands
  255. -------------
  256.  
  257. List File on Printer             ^K-L
  258. Save File and Resume Editing     ^K-S
  259. Save to Named File               ^K-N
  260. Save and Edit New File           ^K-D
  261. Save File and Exit               ^K-X
  262. Abandon File                     ^K-Q
  263.  
  264.  
  265.  
  266. Misc. Commands
  267. --------------
  268.  
  269. Repeat last Find/Replace         ^L
  270. Find                             ^Q-F
  271. Replace                          ^Q-A
  272. Find Compile Error               ^Q-E
  273. Set Marker                       ^K-M
  274. Adjust Indentation               ^K-I
  275. Toggle Word Case                 ^T-U
  276. Toggle Word Capitalisation       ^T-C
  277. Toggle Auto-Indent               ^Q-I
  278. Toggle WP Mode                   ^Q-W  (enables word wrap and paragraph
  279.                                         reformat command)
  280. Reformat Paragraph               ^B
  281. Enter a repeat factor            <ESC>nn (entered before a command or
  282.                                           character causes that command
  283.                                           to be repeated nn times or that
  284.                                           character to be inserted nn
  285.                                           times).
  286.  
  287.  
  288. Note that ^L repeats the last find, or the last replace, or the last find
  289. error. A find error is done automatically by ConTEXT when an error file is
  290. detected, so ^L may be used right away in those cases (up until a normal
  291. find or replace operation has been carried out).
  292.  
  293. The "Repeat" field in Find/Replace dialog boxes is also an undercover
  294. WordStar options field. In other words, as well as being able to enter
  295. digits from 0-9 (specifying a repeat factor), it is also possible to enter
  296. letters from the set "ABGNQUW" each of which correspond to a particular
  297. search option. The meanings of these letters is as follows:- 
  298.  
  299.  n ---------- A number, repeat the operation n times
  300.  A ---------- Abort Operation (same as clicking on CANCEL), except that
  301.               you still need to press return to confirm.
  302.  B ---------- Search Backwards
  303.  G ---------- Global, only applies to Replace. Repeat replace operation
  304.               for all occurrences of the target string searching from
  305.               the current cursor position.
  306.  U ---------- Convert target and pattern to uppercase before
  307.               comparing (ie ignore case differences).
  308.  W ---------- Whole words only. Patterns match only if the candidate is
  309.               delimited by non-alphanumeric characters.
  310.  Q ---------- Set QUERY mode, ie ask user to confirm before completing
  311.               each replace operation.
  312.  
  313.  
  314. The "Set Marker" is used in conjunction with the "Jump to Marker" command
  315. and allows you to quickly return quickly to any point in a file if you have
  316. to leave it for some reason. 
  317.  
  318.  
  319. Notes on Mouse/Menu Operations
  320. ==============================
  321.  
  322. The functions provided in the menus are more or less the same as those
  323. provided in the WordStar/Turbo Command Set. Additional features are
  324.  
  325.    1. The text cursor may be quickly moved to any position on the
  326.       screen by pointing with the mouse and clicking once with the
  327.       left mouse button.
  328.       
  329.    2. Blocks may be marked by pointing with the mouse to the first character
  330.       of the block, then holding down the left mouse button while the
  331.       mouse cursor is moved to the last character of the block. A box
  332.       will be grown around the text to be marked. When the box encloses
  333.       all of the desired text, the mouse button may be released. The
  334.       marked block will be highlighted. Obviously, this method may only
  335.       be used when the entire text is visible on the screen at once,
  336.       otherwise one of the alternative methods (eg menu or WordStar
  337.       command or function keys) must be used.
  338.       
  339.       
  340.  
  341. Processing of Compile Errors
  342. ============================
  343.  
  344. Errors are handled in the same way as the standard TDI editor. When a
  345. file is selected for editing ConTEXT looks for a matching file ending
  346. in ".ERM" (or ".ERD" if the file is a definition module). ConTEXT uses
  347. information from this file to mark errors in the source file. The
  348. marker used looks like this - '@'.
  349.  
  350.  
  351. Macros and Macro Syntax
  352. =======================
  353.  
  354. The best way to describe the macro syntax is by example, so here is a
  355. simple macro:-
  356.  
  357. .macro R
  358. REPEAT
  359.  
  360. UNTIL ;$
  361.  
  362.  
  363. All macros (in written form that is), start with the header ".macro c"
  364. where c can be any single character. This entire header (including the
  365. character) is case dependant - ".MACRO" is not acceptable, and 'C' is not
  366. the same as 'c' for the identifying character. The macro itself is then a
  367. sequence of characters terminated by the character '$'.  It is also
  368. possible to invoke functions from within a macro by enclosing a "function
  369. number" in angle brackets - if we elaborate our example a little:-
  370.  
  371. .macro R
  372. REPEAT
  373.  
  374. UNTIL ;
  375. <1><6:4><1>$
  376.  
  377.  
  378. "<1>" means "Execute function 1" (Function 1 is the Cursor-Up command, a
  379. list of function numbers can be found in Appendix A, and is also displayed
  380. in the CCONTEXT program. You don't need to know function numbers if you use
  381. the "Record Macro" way of creating the macro). The second function looks a
  382. little strange bacause it specifies a repeat factor - "<6:4>" means repeat
  383. function 4 (cursor right), 6 times. Always remember that the repeat factor
  384. is the first number, then a colon, then the function number. It is possible
  385. to specify a repeat factor without specifying a function to execute, in
  386. which case the repeat factor is reserved for the character following the
  387. closing angle bracket, for example the sequence:- 
  388.  
  389.                   <45:>*
  390.  
  391. Will write the '*' character 45 times. Finally, the angle bracket can be
  392. used as an escape character to introduce a character that would otherwise
  393. have special meaning to the macro syntax checker, for example the
  394. sequence:-
  395.  
  396.                   <$
  397.  
  398. means "insert the character '$' in the text - do not treat this as the end
  399. of the macro". Generally speaking any character may be placed after a left
  400. angle bracket to be literally inserted into the text - the following
  401. characters can ONLY be inserted in this way:-
  402.  
  403.            '<'    '$'     '|'
  404.  
  405. Note that when using the '<' escape to enter special characters that you do
  406. not need to enter a closing bracket, in fact if you do you will find it
  407. also inserted into the text!.
  408.  
  409. The last thing you may find useful to know about macro syntax is that you
  410. can replace any occurrence of a carriage return with the character '|'.
  411. This allows you to write your macros in a more compact form. If we take our
  412. example for the last time we can write it thusly:- 
  413.  
  414.      .macro R|REPEAT||UNTIL ;|<1><6:4><1>$
  415.  
  416. The file MACROS.TXT contains examples of several macros that you may find
  417. useful, including one to strip out hard tabs from a text file, plus several
  418. of use to Modula-2 programmers. The macros in this file get bound in to the
  419. configuration file and seem to the ConTEXT user to be built in commands of
  420. the editor - saves having to re-enter your favorite macros every time!
  421.  
  422. Macros can be created in three ways:-
  423.  
  424.      1. Write your macro in text form into the MACROS.TXT file and use the
  425.         CCONTEXT program to bind it into the editor.
  426.      2. Write your macro in text form then read it with the "Read Macro"
  427.         command.
  428.      3. Record a macro by invoking the "Record Macro" command, do whatever
  429.         it is once, then invoke the "Record Macro" command again to
  430.         complete the recording.
  431.  
  432. However you create your macro you need to remember the character you used
  433. to identify it, because this is asked for when you invoke the "Execute
  434. Macro" command, and when you invoke the "Write Macro" command. The "Write
  435. Macro" command can be used to write *any* macro out in text form -
  436. regardless of how it was created.
  437.  
  438.  
  439.  
  440. The CCONTEXT (Configure ConTEXT) Program
  441. ========================================
  442.  
  443. CCONTEXT should be simple enough to operate (in fact I hope that it is
  444. self-explanetory), however this section will summarise its operation.
  445.  
  446. The CCONTEXT program is used to configure the keyboard commands, and also
  447. to bind in macros and compiler error messages into the editor. When you run
  448. the program the following menu is displayed:- 
  449.  
  450.  
  451.       1.  Edit Keyboard Commands
  452.  
  453.       2.  Edit Misc Details
  454.  
  455.       Q.  Quit
  456.  
  457.  
  458.  
  459. Option 1 - Edit Keyboard Commands
  460. ---------------------------------
  461.  
  462. Option one brings up a secondary menu consisting of a list of the editor
  463. commands which you may configure, selectable by function number (the
  464. function numbers shown are the same as those recognised by the macro
  465. processor).
  466.  
  467. You may then pick a function that you want to configure by typing its
  468. function number. You may provide more than one command sequence for any
  469. function, but there must be no more than 120 sequences in total (this
  470. allows for two sequences for each function, which should be plenty).
  471.  
  472. After you have picked the function that you want to configure, you are
  473. given the opportunity to add, or remove a function. To add a function just
  474. press 'a', then type the two characters that make up the command. If the
  475. command is only one character then type <CR> for the second character.
  476.  
  477.  
  478.  
  479. Option 2 - Edit Misc Details
  480. ----------------------------
  481.  
  482. This option allows you to configure such details as:-
  483.  
  484.      a) The background color (black or white).
  485.  
  486.      b) The tab sizes (two tab commands are provided).
  487.  
  488.      c) The initial settings of various flags, ie Insert Mode, Auto-Indent
  489.         On/Off, WP Mode.
  490.  
  491.  
  492. Q - Quit
  493. --------
  494.  
  495. Quits the CCONTEXT program and causes it to write out the new configuration
  496. file. For this the ERRORS.TXT file must be in the current directory, and
  497. you should have the MACROS.TXT file also in the current directory if you
  498. want the macros therein to be bound into the configuration. MACROS.TXT is
  499. simply a list of the macros you want bound in, specified using the same
  500. macro syntax used by the Macro Processor which is part of the ConTEXT
  501. editor. The only "extras" in MACROS.TXT is that you may add comments before
  502. and after macros (but not within macros!). Any line starting with a ';' in
  503. the first column is treated as a comment line and is ignored. You may also
  504. have blank lines in your macro file - before and after a macro blank lines
  505. have no significance, within a macro they certainly do!  See the supplied
  506. MACROS.TXT file for an actual example.
  507.  
  508.  
  509. APPENDIX A - Macro Processor Function Numbers
  510. ---------------------------------------------
  511.  
  512.    Function     Function
  513.    Number       Description
  514.    --------     -----------
  515.       1         Cursor Up
  516.       2         Cursor Down
  517.       3         Cursor Left
  518.       4         Cursor Right
  519.       5         Backspace
  520.       6         Page Up
  521.       7         Page Down
  522.       8         Word Move Left
  523.       9         Word Move Right
  524.      10         Scroll Up
  525.      11         Scroll Down
  526.      12         Start Of File
  527.      13         End Of File
  528.      14         Delete Char
  529.      15         Delete Line
  530.      16         Delete to EOL
  531.      17         Delete Word
  532.      18         Undelete Lines
  533.      19         Insert Line
  534.      20         Left on Line
  535.      21         Left on Text
  536.      22         Right on Text
  537.      23         Mark Start of Block
  538.      24         Mark End of Block
  539.      25         Mark Single Word
  540.      26         Find Start of Block
  541.      27         Find End of Block
  542.      28         Hide/Display Block
  543.      29         Copy Block
  544.      30         Move Block
  545.      31         Delete Block
  546.      32         Read Block
  547.      33         Write Block
  548.      34         Print Block
  549.      35         Find
  550.      36         Find and Replace
  551.      37         Find Compile Error
  552.      38         Find/Replace again
  553.      39         Set Marker
  554.      40         Jump to Marker
  555.      41         Print File
  556.      42         Save File
  557.      43         Save File As...
  558.      44         Save & Edit new File
  559.      45         Save and Exit
  560.      46         Abandon Changes
  561.      47         Adjust Indent
  562.      48         Switch Window
  563.      49         Execute Macro
  564.      50         Read Macro
  565.      51         Record Macro
  566.      52         Write Macro
  567.      53         Tab
  568.      54         Tab 2
  569.      55         Toggle Word Case
  570.      56         Toggle Capitalisation
  571.      57         Toggle Insert Mode
  572.      58         Toggle Auto-Indent
  573.      59         Toggle WP Mode
  574.      60         Reformat Paragraph
  575.  
  576.  
  577.